package com.beyondbit.hr.report.support.render;

import com.beyondbit.hr.report.support.ReportConverter;
import com.beyondbit.hr.report.support.ReportRenderer;
import net.sf.jasperreports.engine.JRAbstractExporter;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.export.JRPdfExporter;
import net.sf.jasperreports.export.*;
import org.springframework.http.MediaType;

import java.io.OutputStream;
import java.util.Arrays;
import java.util.List;

public class PDFRender extends AbstractRender<JRPdfExporter> {
    @Override
    public List<MediaType> getSupportedMediaTypes() {
        return Arrays.asList(ReportConverter.PDF);
    }

    @Override
    public ExporterConfiguration defaultExporterConfiguration() {
        SimplePdfExporterConfiguration configuration = new SimplePdfExporterConfiguration();
        configuration.setCreatingBatchModeBookmarks(true);
        return configuration;
    }

    @Override
    public ReportExportConfiguration defaultReportExportConfiguration() {
        return null;
    }


    @Override
    public JRPdfExporter exporter() {
        JRPdfExporter pdfExporter = new JRPdfExporter();
        return pdfExporter;
    }

}
